package com.wu.llpsw.effect.buff;

import com.wu.llpsw.data.levelData;
import com.wu.llpsw.data.playerData;
import com.wu.llpsw.data.tianFu;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;

public class yehuoduanti extends BaseEffect{
    public yehuoduanti(MobEffectCategory type, int color, boolean isInstant) {
        super(type, color, isInstant);
    }

    //buff隔多久生效一次
    @Override
    protected boolean canApplyEffect(int remainingTicks, int level) {
        return remainingTicks % 40 == 0;
    }

    //效果作用用于身上的效果
    @Override
    public void applyEffectTick(LivingEntity entity, int value) {
        if(entity instanceof ServerPlayer){
            Player player=(Player) entity;
            double attack= playerData.getAttack(player);
            //着火
            player.setSecondsOnFire(4);
            //根据玩家攻击力给予伤害
            player.hurt(DamageSource.GENERIC, (float) (attack*0.1f));
            tianFu.setadd(player,0.003f,0.001f,0.00f);
            levelData.setParam(player,player.experienceLevel);
        }
    }


    //申明是debuff还是buff
    @Override
    public boolean isBeneficial() {
        return false;
    }
}
